package com.sixkey.utils;

/**
 * ClassName: JodaTimeUtils
 * Package: com.sixkey.utils
 * Description:
 *
 * @Author: @weixueshi
 * @Create: 2023/10/10 - 22:28
 * @Version: v1.0
 */

import org.joda.time.Days;
import org.joda.time.Hours;
import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;

/**
 * 日期时间处理工具类
 */
public class JodaTimeUtils {

    // 获取当前日期和时间
    public static LocalDateTime getCurrentDateTime() {
        return new LocalDateTime();
    }

    // 判断一个日期时间是否在另一个日期时间之前
    public static boolean isBefore(LocalDateTime dateTime1, LocalDateTime dateTime2) {
        return dateTime1.isBefore(dateTime2);
    }
    // 判断一个日期时间是否在另一个日期时间之后
    public static boolean isAfter(LocalDateTime dateTime1, LocalDateTime dateTime2) {
        return dateTime1.isAfter(dateTime2);
    }
    // 判断两个日期时间是否相等
    public static boolean isEqual(LocalDateTime dateTime1, LocalDateTime dateTime2) {
        return dateTime1.equals(dateTime2);
    }

    // 计算两个日期时间之间的小时数
    public static int getHoursBetween(LocalDateTime startDateTime, LocalDateTime endDateTime) {
        Hours hours = Hours.hoursBetween(startDateTime, endDateTime);
        return hours.getHours();
    }
}
